# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>

pkgname=afl-utils
pkgver=1.34a
pkgrel=6
pkgdesc='Utilities for automated crash sample processing/analysis, easy afl-fuzz job management and corpus optimization'
url='https://gitlab.com/rc0r/afl-utils'
arch=('any')
license=('Apache')
depends=('afl' 'coreutils' 'python' 'rsync')
optdepends=('sqlite: database support'
            'screen: interactive/screen mode support'
            'gdb: gdb script execution support')
makedepends=('python-setuptools')
source=(${pkgname}-${pkgver}.tar.gz::https://gitlab.com/rc0r/afl-utils/-/archive/v${pkgver}/afl-utils-v${pkgver}.tar.gz fix-dependencies.patch)
sha256sums=('8ec99f4832a80400a0457612af487bb430ca4a53a17f63f9f8d72af03d97ab96'
            '343d1c6db64e70f87524ff47c4733819b3ed519bf7ee30f8e43baa64b2ac8f3f')
sha512sums=('d65ecaf022641cffe8466c1d47d5b14455c41c42f5604c2ee50dbe35a044a80d07931bc8b99192b4ad5ef4464e9bb3e9f05dfff195943b37435142dc6abcd1af'
            '6a4c4df1715716709515a57fcc64d53e8b63363f49a643368afc76cca023a1fd79bee3482839e38680fd9f78f2b4e14879c95577b5f5db8aca4dae113ddf1a97')

prepare() {
  cd ${pkgname}-v${pkgver}
  # https://gitlab.com/rc0r/afl-utils/-/issues/65
  patch -Np1 -i ${srcdir}/fix-dependencies.patch
}

build() {
  cd ${pkgname}-v${pkgver}
  python setup.py build
}

package() {
  cd ${pkgname}-v${pkgver}
  python setup.py install -O1 --root="${pkgdir}"
  rm -rf "${pkgdir}"/usr/lib/python*/site-packages/tests
  install -Dm 644 README.md docs/CHANGELOG.md -t "${pkgdir}/usr/share/doc/${pkgname}"
  install -Dm 644 config/* -t "${pkgdir}/usr/share/doc/${pkgname}"
}

# vim: ts=2 sw=2 et:
